import http from './axios';
// import qs from 'qs'


const contextPath = process.env.VUE_APP_CONTEXT_PATH;
let proxyConf = '';  //本地开发走vue server代理，处理跨域问题
console.log(process.env)
if (process.env.VUE_APP_CURRENTMODE === 'dev') {
    proxyConf = '/dev'
    console.log(proxyConf);
}


export default {
    get(url, config) {
        let _url = `${proxyConf}${contextPath}${url}`;
        return http.get(_url, config);
    },
    post(url, params, config) {
        let _url = `${proxyConf}${contextPath}${url}`;
        //自定义头请求
        if (config && config.headers['Content-Type'] === 'multipart/form-data') {
            return http.post(_url, params, config)
        }
        // 默认请求
        return http.post(_url, params, config)
    },
    configPost(url) {
        return http.get(url)
    }

}